package com.zhongke.cotrun.mapper;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhongke.cotrun.model.pojo.ServiceRelease;
import com.zhongke.cotrun.model.pojo.ServiceReleaseVo;
import org.apache.ibatis.annotations.*;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

public interface ServiceReleaseMapper {


    /**
     * 新增服务
     */
    @Insert("INSERT INTO `service_release` (`link_user_id`, `service_name`, `sercice_type`, `region`, `isnationwide`, `price`, `negotiable`, `linkman`, `phonenumber`, `advertising_map`, `service_details`, `key_word`, `create_time`,`statue`) VALUES " +
            "(#{linkUserId}, #{serviceName}, #{serciceType}, #{region}, #{isnationwide}, #{price}, #{negotiable}, #{linkman}, #{phonenumber}, #{advertisingMap}, #{serviceDetails}, #{keyWord}, NOW(),0)")
    public boolean insertServiceRelease(ServiceRelease serviceRelease);

    /**
     * 按条件搜索服务列表
     *
     * @param serviceRelease
     * @return
     */
    public List<ServiceReleaseVo> selectSercicereleaseByCondition(ServiceRelease serviceRelease);

    /**
     * 根据id查询具体的服务内容
     * @param serviceReleaseId
     * @return
     */

    @Select("SELECT * from service_release WHERE service_release_id=#{serviceReleaseId}")
    public ServiceReleaseVo selectServiceReleaseById(Integer serviceReleaseId);

    /**
     * 修改服务信息
     * @param serviceRelease
     * @return
     */
    public  boolean updateSelectServiceRelease(ServiceRelease serviceRelease);

    /**
     * 删除服务
     * @param serviceReleaseId
     * @param statue
     * @return
     */
    @Update("UPDATE service_release SET statue=#{statue} WHERE service_release_id= #{serviceReleaseId}")
    public boolean delectServiceRelease(@Param("serviceReleaseId") Integer serviceReleaseId, @Param("statue") Integer statue);
}
